package face.pay.dao;

import face.pay.entity.TerminalTargetDayCount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Classname TerminalTargetCountDao
 * @Description JJL
 * @Date 2019/10/23 11:59
 */
@Mapper
public interface TerminalTargetDayCountDao {

    /**
     * 统计商家收入
     * @param mchUserId
     * @return
     */
    List<TerminalTargetDayCount> queryMchTerTargets(@Param("mchUserId") Integer mchUserId,
                                                          @Param("oemId")Integer oemId,
                                                          @Param("startTime") String startTime,
                                                          @Param("endTime")String endTime);

    /**
     * 统计代理商下所有商家收入
     * @param mchUserName
     * @return
     */
    List<TerminalTargetDayCount> queryUserTargets(@Param("agencyId")Integer agencyId,
                                                       @Param("oemId")Integer oemId,
                                                       @Param("mchUserName") String mchUserName,
                                                       @Param("startTime") String startTime,
                                                       @Param("endTime")String endTime);

    /**
     * 根据日期 统计设备达标率
     * @param dataDay
     * @return
     */
    List<TerminalTargetDayCount> terminalTargetDayCountTask(@Param("dataDay")String dataDay);



    /**
     * 添加到 terminal_target_day_count表中
     * @param targetCounts
     */
    void insert(List<TerminalTargetDayCount> targetCounts);

    /**
     * 得到最近一次统计的时间
     * @return
     */
    String queryMaxTime();

    /**
     * 查询商家当日明细
     * @param mchUserId
     * @return
     */
    List<TerminalTargetDayCount> queryToDayMchTerTargets(@Param("mchUserId")Integer mchUserId);

    /**
     * 查询代理商当日明细
     * @param agencyId
     * @return
     */
    List<TerminalTargetDayCount> queryToDayUserTargets(@Param("agencyId")Integer agencyId,@Param("mchUserName") String mchUserName);

}
